﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using EzDesk.MVVMBase;
using EzDesk.Generic.WPF;
using EzDesk.DesktopClient.Event;

namespace EzDesk.DesktopClient.ViewBase
{
    public class WindowBaseNotMainView:WindowExtenBase,IView
    {
       
        public Double YOffsetWithMainWindow { get; set; }

        public WindowBaseNotMainView():base()
        {
            InitGlobalEvent();
        }

        private void InitGlobalEvent()
        {
            MainWindowMoveEvent.Instance.Subscribe(this.OnMainWindowMove);
            MainWindowFocusEvent.Instance.Subscribe(this.OnMainWindowFocus);
        }

        protected virtual void OnMainWindowFocus(MainWindowFocusArgs args)
        {
            this.ToBeTop();
        }

        protected virtual void OnMainWindowMove(MainWindowMoveArgs args)
        {
            this.ToBeside(args.MainWindow as Window, yOffset: this.YOffsetWithMainWindow);
        }
    }
}
